package com.echo.blog.core.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.oauth2.provider.token.TokenStore;
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter;
import org.springframework.security.oauth2.provider.token.store.JwtTokenStore;

/**
 * @version: V1.0
 * @author: chentailai
 * @description: jwt实现token的缓存
 * @className: JwtTokenConfig
 * @packageName: com.echo.auth.core.config
 * @data: 2020/3/27 20:02
 **/
@Configuration
public class JwtTokenConfig {

   @Bean
   public TokenStore jwtTokenStore() {
       return new JwtTokenStore(jwtAccessTokenConverter());
  }

   @Bean
   public JwtAccessTokenConverter jwtAccessTokenConverter() {
       JwtAccessTokenConverter accessTokenConverter = new JwtAccessTokenConverter();
       accessTokenConverter.setSigningKey("chentl888");
//       accessTokenConverter.setVerifierKey("chentl888");
       return accessTokenConverter;
  }
}